{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Problem Solving "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Problem 1**  \n",
    "Given an array `arr` of size `N`.  \n",
    "\n",
    "Output the maximum value of `abs(arr[i] - arr[j])`.\n",
    "```\n",
    "Input: arr = [0, -1, 5, 7, 10]\n",
    "Output: 11\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "## Solution"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Problem 2**  \n",
    "Given a read-only array `arr` of size `N`.\n",
    "The property of this array is that, \n",
    "1. Each element of this array is going to fall in the range of 1 to N (where N is the size of array).\n",
    "2. All element comes exaclty once, except for 1 element. Only one element comes twice.\n",
    "\n",
    "Output the repeated value?\n",
    "```\n",
    "Input: arr = [3, 1, 2, 5, 3]  \n",
    "Output: 3\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "## Solution"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Problem 3**  \n",
    "Given `N` bars each of width `1` unit and length represented in an array.  \n",
    "Output the units of water that is going to be trapped.\n",
    "```\n",
    "Input: height = [0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1]\n",
    "Output: 6\n",
    "```\n",
    "![title](img/rainwatertrap.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "## Solution"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
